INSERT INTO Channel
(MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Description, Enabled, ConnectionPriority, Trend)
VALUES((SELECT ID FROM Meter WHERE Name LIKE '%Avon%'),
(SELECT ID FROM Asset WHERE AssetName LIKE '%Avon%'),
(SELECT ID FROM MeasurementType WHERE Name LIKE 'Voltage'),
(SELECT ID FROM MeasurementCharacteristic WHERE Name LIKE 'FlkrPLT'),
(SELECT ID FROM Phase WHERE Name LIKE 'AN'),
'V Flicker Plt Slide A', 0, 1, 0, 0, NULL, 1, 0, 1);
INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes)
VALUES
((SELECT ID FROM Channel WHERE Name = 'V Flicker Plt Slide A' AND MeterID = (SELECT ID FROM Meter WHERE Name LIKE '%Avon%')),
(SELECT ID FROM SeriesType WHERE Name LIKE 'Average'),
'PLT_VA');
INSERT INTO Channel
(MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Description, Enabled, ConnectionPriority, Trend)
VALUES((SELECT ID FROM Meter WHERE Name LIKE '%Avon%'),
(SELECT ID FROM Asset WHERE AssetName LIKE '%Avon%'),
(SELECT ID FROM MeasurementType WHERE Name LIKE 'Voltage'),
(SELECT ID FROM MeasurementCharacteristic WHERE Name LIKE 'FlkrPLT'),
(SELECT ID FROM Phase WHERE Name LIKE 'BN'),
'V Flicker Plt Slide B', 0, 1, 0, 0, NULL, 1, 0, 1);
INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes)
VALUES
((SELECT ID FROM Channel WHERE Name = 'V Flicker Plt Slide B' AND MeterID = (SELECT ID FROM Meter WHERE Name LIKE '%Avon%')),
(SELECT ID FROM SeriesType WHERE Name LIKE 'Average'),
'PLT_VB');
INSERT INTO Channel
(MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Description, Enabled, ConnectionPriority, Trend)
VALUES((SELECT ID FROM Meter WHERE Name LIKE '%Avon%'),
(SELECT ID FROM Asset WHERE AssetName LIKE '%Avon%'),
(SELECT ID FROM MeasurementType WHERE Name LIKE 'Voltage'),
(SELECT ID FROM MeasurementCharacteristic WHERE Name LIKE 'FlkrPLT'),
(SELECT ID FROM Phase WHERE Name LIKE 'CN'),
'V Flicker Plt Slide C', 0, 1, 0, 0, NULL, 1, 0, 1);
INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes)
VALUES
((SELECT ID FROM Channel WHERE Name = 'V Flicker Plt Slide C' AND MeterID = (SELECT ID FROM Meter WHERE Name LIKE '%Avon%')),
(SELECT ID FROM SeriesType WHERE Name LIKE 'Average'),
'PLT_VC');
